package xhwl.retrofitrx.token;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017-06-19.
 */

public class TokenApi extends BaseApi {
    Req req;
    public TokenApi(){
        req=new Req();
    }
    public TokenApi(boolean showDialog){
        req=new Req();
        setShowDialog(showDialog);
    }
    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(TokenApiService.class).requestToken(requestBody);
    }
    private class Req{
        private String Appid;
        private String Appsecret;

        public Req(){
            Appid=Config.appId;
            Appsecret=Config.appSecret;
        }
    }

}
